package com.shy.configs.mvc.models;

import com.shy.configs.common.enums.RCode;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.Getter;
import lombok.NoArgsConstructor;

@Getter
@NoArgsConstructor
@AllArgsConstructor
public class AjaxResult {
    private Integer code;
    private String msg;
    private Object data;


    public static AjaxResult success() {
        return new AjaxResult(RCode.SUCCESS.getCode(), RCode.SUCCESS.getMessage(), "");
    }
    public static AjaxResult success(Object data) {
        return new AjaxResult(RCode.SUCCESS.getCode(), RCode.SUCCESS.getMessage(), data);
    }

    public static AjaxResult fail(RCode rCode) {
        return new AjaxResult(rCode.getCode(), rCode.getMessage(), "");
    }

}
